package bch.maven.plugin.guava;

import java.util.*;
import java.util.stream.*;

public class SpliteratorExample {
    public static void main(String[] args) {
        List<String> list = Arrays.asList("A", "B", "C", "D", "E");

        // 使用 Spliterators.spliterator
        Spliterator<String> spliterator = Spliterators.spliterator(
                list.iterator(),   // Iterator
                list.size(),       // size
                Spliterator.ORDERED | Spliterator.SIZED // 特性
        );

        // 转为 Stream
        Stream<String> stream = StreamSupport.stream(spliterator, false);

        // 遍历打印
        stream.forEach(System.out::println);
    }
}
